#include "hv.h"
#include "EventLoop.h"
#include <cstdio>
#include "st.h"

using namespace hv;

int main(int argc, char const *argv[])
{
    auto loop = std::make_shared<EventLoop>();

    bool real = false;

    loop->setInterval(100, [&real](TimerID timeid){
        // 持续为true 2000ms
        auto [ret, et] = StFactory::instance()->ton("ton1")(real, 2000);
        if(ret){
            fprintf(stdout, "et : %d\n", et);
        }
    });

    loop->setTimeout(1000, [&real](TimerID timerid){
        real = true;
    });

    loop->run();

    return 0;
}
